package com.appkudos.model;
import java.util.Date;

public class Recommendation implements Comparable<Recommendation>{

	private String recid;
	private String sender;
	private String receiver;
	private boolean isGroupRecipient;
	private String appid;
	private String message;
	private String dateSent;
	
	public Recommendation(){
		
	}
	
	public Recommendation(String recid, String message, 
			String sender, String receiver, String dateSent){
		this.setRecid(recid);
		this.message = message;
		this.sender = sender;
		this.receiver = receiver;
		this.dateSent = dateSent;
	}

	public Recommendation(String recid, String message, 
			String sender, String receiver, String dateSent, boolean isGroupRecipient, String appid){
		this.setRecid(recid);
		this.message = message;
		this.sender = sender;
		this.receiver = receiver;
		this.isGroupRecipient = isGroupRecipient;
		this.dateSent = dateSent;
		this.appid = appid;
	}

	public String getSender() {
		return sender;
	}

	public void setSender(String sender) {
		this.sender = sender;
	}

	public String getReceiver() {
		return receiver;
	}

	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public boolean isGroupRecipient() {
		return isGroupRecipient;
	}

	public void setGroupRecipient(boolean isGroupRecipient) {
		this.isGroupRecipient = isGroupRecipient;
	}

	public String getAppid() {
		return appid;
	}

	public void setAppid(String appid) {
		this.appid = appid;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
	public String getDateSent() {
		return dateSent;
	}

	public void setDateSent(String dateSent) {
		this.dateSent = dateSent;
	}

	
	/***
	 * Sorts Recommendations by date sent
	 * @param arg
	 * @return 
	 */
	@Override
	public int compareTo(Recommendation obj) {
		if(Date.parse(obj.dateSent) < Date.parse(dateSent)){
			return 1;
		}else if(Date.parse(obj.dateSent) > Date.parse(dateSent)){
			return -1;
		}
		return 0;
	}

	public void setRecid(String recid) {
		this.recid = recid;
	}

	public String getRecid() {
		return recid;
	}

}
